﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ServiceModel.Dispatcher;
using System.ServiceModel.Channels;
using System.ServiceModel;

namespace EnterpriseLibraryWrapper
{
    public class LogMessageTracer : IDispatchMessageInspector
    {
        public object AfterReceiveRequest(ref Message request,
            IClientChannel channel,
            InstanceContext instanceContext)
        {
            LoggerWrapper log = new LoggerWrapper();
            log.Write(0, "TraceWCF", "Mensagem Recebida", request.ToString());
            return null;
        }
        public void BeforeSendReply(ref Message reply, object
            correlationState)
        {
        }

        public void AfterReceiveReply(ref Message reply, object
            correlationState)
        {
        }
        public object BeforeSendRequest(ref Message request,
            IClientChannel channel)
        {
            return null;
        }
    }
}


